{% import "_includes/forms" as forms %}

{% set targetPrefix = "datetime#{random()}-" %}

{{ forms.radioGroupField({
    id: 'dateTime',
    name: 'dateTime',
    options: options,
    value: value,
    toggle: true,
    targetPrefix: ".#{targetPrefix}",
    tip: value == 'showTime' ? 'Time fields are better suited for managing Time-only values.'|t('app'),
}) }}

{{ forms.selectField({
    fieldClass: [
        "#{targetPrefix}showTime",
        "#{targetPrefix}showBoth",
        value == 'showDate' ? 'hidden',
    ]|filter,
    label: "Minute Increment"|t('app'),
    instructions: 'The number of minutes that timepicker options should be incremented by. (Authors can enter a specific time manually.)'|t('app'),
    id: 'minuteIncrement',
    name: 'minuteIncrement',
    options: incrementOptions,
    value: field.minuteIncrement ? field.minuteIncrement : 30,
}) }}

{{ forms.dateField({
    fieldClass: [
        "#{targetPrefix}showDate",
        "#{targetPrefix}showBoth",
        value == 'showTime' ? 'hidden',
    ]|filter,
    label: 'Min Date'|t('app'),
    id: 'min',
    name: 'min',
    value: field.min,
    errors: field.getErrors('min'),
}) }}

{{ forms.dateField({
    fieldClass: [
        "#{targetPrefix}showDate",
        "#{targetPrefix}showBoth",
        value == 'showTime' ? 'hidden',
    ]|filter,
    label: 'Max Date'|t('app'),
    id: 'max',
    name: 'max',
    value: field.max,
    errors: field.getErrors('max'),
}) }}
